home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat2 / standard / mprotect.z / mprotect
Encoding:
Text File  |  2001-04-17  |  9.2 KB  |  132 lines

  1.  
  2.  
  3.  
  4. mmmmpppprrrrooootttteeeecccctttt((((2222))))                                                        mmmmpppprrrrooootttteeeecccctttt((((2222))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _mmmm_pppp_rrrr_oooo_tttt_eeee_cccc_tttt - set protection of memory mapping
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
  13.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_mmmm_mmmm_aaaa_nnnn_...._hhhh_>>>>
  14.      _iiii_nnnn_tttt _mmmm_pppp_rrrr_oooo_tttt_eeee_cccc_tttt_((((_vvvv_oooo_iiii_dddd _****_aaaa_dddd_dddd_rrrr_,,,, _ssss_iiii_zzzz_eeee______tttt _llll_eeee_nnnn_,,,, _iiii_nnnn_tttt _pppp_rrrr_oooo_tttt_))))_;;;;
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The function _mmmm_pppp_rrrr_oooo_tttt_eeee_cccc_tttt changes the access protections on the mappings
  18.      specified by the range [_a_d_d_r, _a_d_d_r + _l_e_n) to be that specified by _p_r_o_t.
  19.      Legitimate values for _p_r_o_t are the same as those permitted for _mmmm_mmmm_aaaa_pppp and
  20.      are defined in _<<<<_ssss_yyyy_ssss_////_mmmm_mmmm_aaaa_nnnn_...._hhhh_>>>> as:
  21.  
  22.      _PPPP_RRRR_OOOO_TTTT______RRRR_EEEE_AAAA_DDDD       _////_**** _pppp_aaaa_gggg_eeee _cccc_aaaa_nnnn _bbbb_eeee _rrrr_eeee_aaaa_dddd _****_////
  23.      _PPPP_RRRR_OOOO_TTTT______WWWW_RRRR_IIII_TTTT_EEEE      _////_**** _pppp_aaaa_gggg_eeee _cccc_aaaa_nnnn _bbbb_eeee _wwww_rrrr_iiii_tttt_tttt_eeee_nnnn _****_////
  24.      _PPPP_RRRR_OOOO_TTTT______EEEE_XXXX_EEEE_CCCC       _////_**** _pppp_aaaa_gggg_eeee _cccc_aaaa_nnnn _bbbb_eeee _eeee_xxxx_eeee_cccc_uuuu_tttt_eeee_dddd _****_////
  25.      _PPPP_RRRR_OOOO_TTTT______NNNN_OOOO_NNNN_EEEE       _////_**** _pppp_aaaa_gggg_eeee _cccc_aaaa_nnnn _nnnn_oooo_tttt _bbbb_eeee _aaaa_cccc_cccc_eeee_ssss_ssss_eeee_dddd _****_////
  26.      _PPPP_RRRR_OOOO_TTTT______EEEE_XXXX_EEEE_CCCC______NNNN_OOOO_FFFF_LLLL_UUUU_SSSS_HHHH _////_**** _pppp_aaaa_gggg_eeee _cccc_aaaa_nnnn _bbbb_eeee _eeee_xxxx_eeee_cccc_uuuu_tttt_eeee_dddd _---- _cccc_aaaa_cccc_hhhh_eeee _nnnn_oooo_tttt _ssss_yyyy_nnnn_cccc_eeee_dddd _****_////
  27.  
  28.      Not all implementations literally provide all possible combinations.
  29.      _PPPP_RRRR_OOOO_TTTT______WWWW_RRRR_IIII_TTTT_EEEE is often implemented as _PPPP_RRRR_OOOO_TTTT______RRRR_EEEE_AAAA_DDDD_||||_PPPP_RRRR_OOOO_TTTT______WWWW_RRRR_IIII_TTTT_EEEE and _PPPP_RRRR_OOOO_TTTT______EEEE_XXXX_EEEE_CCCC as
  30.      _PPPP_RRRR_OOOO_TTTT______RRRR_EEEE_AAAA_DDDD_||||_PPPP_RRRR_OOOO_TTTT______EEEE_XXXX_EEEE_CCCC.  This is true for all SGI implementations.  In
  31.      particular, MIPS processors do not support a separate execute permission.
  32.      Any page that can be read can be executed from, even if _PPPP_RRRR_OOOO_TTTT______EEEE_XXXX_EEEE_CCCC is not
  33.      specified.  As described below, the operating system uses _PPPP_RRRR_OOOO_TTTT______EEEE_XXXX_EEEE_CCCC as a
  34.      flag to indicate it may need to perform certain platform dependent
  35.      functions that may be needed to properly execute instructions from the
  36.      associated page.  However, no implementation will permit a store to
  37.      succeed where _PPPP_RRRR_OOOO_TTTT______WWWW_RRRR_IIII_TTTT_EEEE has not been set.
  38.  
  39.      Applications such as compiling interpreters that generate code in their
  40.      data areas and then wish to execute it, should use _mmmm_pppp_rrrr_oooo_tttt_eeee_cccc_tttt to add
  41.      _PPPP_RRRR_OOOO_TTTT______EEEE_XXXX_EEEE_CCCC permission to the corresponding pages.  This must be done after
  42.      the code has been generated, but before it is executed.  This causes any
  43.      necessary machine dependent activities, such as cache flushing, to occur
  44.      that are required prior to executing from any part of the process's
  45.      address space other than the program or library text segments.  If the
  46.      generated instructions are altered after the previous call to _mmmm_pppp_rrrr_oooo_tttt_eeee_cccc_tttt
  47.      was made to mark the data as executable, then _mmmm_pppp_rrrr_oooo_tttt_eeee_cccc_tttt must be called to
  48.      again add _PPPP_RRRR_OOOO_TTTT______EEEE_XXXX_EEEE_CCCC before the new code is executed in order to prepare
  49.      the new contents of the page(s) for proper execution.
  50.  
  51.      In some cases, it may be better for performance reasons to keep execute
  52.      permissions on a page without syncing the instruction and data cache.  In
  53.      these cases, specify _PPPP_RRRR_OOOO_TTTT______EEEE_XXXX_EEEE_CCCC______NNNN_OOOO_FFFF_LLLL_UUUU_SSSS_HHHH to keep the cache from being
  54.      flushed.  However, it is then up to the programmer to call _mmmm_pppp_rrrr_oooo_tttt_eeee_cccc_tttt with
  55.      _PPPP_RRRR_OOOO_TTTT______EEEE_XXXX_EEEE_CCCC to sync the cache when instructions in a page change.
  56.  
  57.  
  58.  
  59.  
  60.  
  61.                                                                         PPPPaaaaggggeeee 1111
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. mmmmpppprrrrooootttteeeecccctttt((((2222))))                                                        mmmmpppprrrrooootttteeeecccctttt((((2222))))
  69.  
  70.  
  71.  
  72. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  73.      On success, _mmmm_pppp_rrrr_oooo_tttt_eeee_cccc_tttt returns _0000; on failure, _mmmm_pppp_rrrr_oooo_tttt_eeee_cccc_tttt returns _----_1111 and sets
  74.      _eeee_rrrr_rrrr_nnnn_oooo to indicate an error.
  75.  
  76. EEEERRRRRRRROOOORRRRSSSS
  77.      Under the following conditions, the function _mmmm_pppp_rrrr_oooo_tttt_eeee_cccc_tttt fails and sets
  78.      _eeee_rrrr_rrrr_nnnn_oooo to:
  79.  
  80.      _EEEE_AAAA_CCCC_CCCC_EEEE_SSSS _p_r_o_t specifies a protection that violates the access permission
  81.             the process has to the underlying memory object.
  82.  
  83.      _EEEE_AAAA_GGGG_AAAA_IIII_NNNN _p_r_o_t specifies _PPPP_RRRR_OOOO_TTTT______WWWW_RRRR_IIII_TTTT_EEEE over a _MMMM_AAAA_PPPP______PPPP_RRRR_IIII_VVVV_AAAA_TTTT_EEEE mapping and there are
  84.             insufficient memory resources to reserve for locking the private
  85.             page.
  86.  
  87.      _EEEE_IIII_NNNN_VVVV_AAAA_LLLL _a_d_d_r is not a multiple of the page size as returned by _ssss_yyyy_ssss_cccc_oooo_nnnn_ffff.
  88.  
  89.      _EEEE_NNNN_OOOO_MMMM_EEEE_MMMM The argument _l_e_n has a value less than or equal to _0000.
  90.  
  91.      _EEEE_NNNN_OOOO_MMMM_EEEE_MMMM Addresses in the range [_a_d_d_r, _a_d_d_r + _l_e_n) are invalid for the
  92.             address space of a process, or specify one or more pages which are
  93.             not mapped.
  94.  
  95.      When _mmmm_pppp_rrrr_oooo_tttt_eeee_cccc_tttt fails for reasons other than _EEEE_IIII_NNNN_VVVV_AAAA_LLLL, the protections on
  96.      some of the pages in the range [_a_d_d_r, _a_d_d_r + _l_e_n) may have been changed.
  97.      If the error occurs on some page at _a_d_d_r_2, then the protections of all
  98.      whole pages in the range [_a_d_d_r, _a_d_d_r_2] will have been modified.
  99.  
  100. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  101.      mmap(2), plock(2), sysconf(3C)
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                                                         PPPPaaaaggggeeee 2222
  128.  
  129.  
  130.  
  131.